{{#if @prompts}}
  <div local-class='prompt-button' tabindex='0'>
    <div local-class='prompt-button-quick-access' data-rtl={{@rtl}}>
      {{#each this.quickAccessPrompts as |prompt|}}
        <AsyncButton
          title={{prompt.name}}
          @onClick={{perform this.submitTask prompt.id}}
          local-class='prompt-button-quick-access-icon'
          class='button button--iconOnly button--filled button--borderless button--white'
        >
          {{prompt.quickAccess}}
        </AsyncButton>
      {{/each}}
    </div>

    <button {{on 'click' (fn this.onPromptClick)}} local-class='button' class='button button--iconOnly button--link button--filled button--white'>
      {{inline-svg '/assets/sparkle.svg' class='button-icon'}}
    </button>
  </div>
{{/if}}

{{#if this.promptOpened}}
  <AccModal @onClose={{fn this.onPromptClose}}>
    <div local-class='content' {{did-insert (perform this.fetchPromptOptions)}}>
      <div local-class='title'>
        {{inline-svg 'assets/sparkle.svg' local-class='title-icon'}}
        {{t 'components.improve_prompt.title'}}
      </div>

      <div local-class='current-text'>{{@text}}</div>

      {{#if this.promptOptions}}
        <AccSelect @selected={{this.promptOptionValue}} @options={{this.promptOptions}} @onchange={{fn this.onSelectPromptOption}} />
      {{/if}}

      {{#if this.promptResult}}
        {{#if this.promptResultUnchanged}}
          <div local-class='result-text result-text--unchanged'>{{t 'components.improve_prompt.no_changes'}}</div>
        {{else}}
          <div local-class='result-text'>{{this.promptResult}}</div>
        {{/if}}
      {{/if}}

      <div local-class='actions'>
        <AsyncButton @onClick={{perform this.submitTask}} @loading={{this.isSubmitting}} class='button button--filled button--white'>
          {{t 'components.improve_prompt.run'}}
        </AsyncButton>

        {{#if this.promptResult}}
          {{#unless this.promptResultUnchanged}}
            <button {{on 'click' (fn this.onAcceptText)}} class='button button--filled'>
              {{t 'components.improve_prompt.accept'}}
            </button>
          {{/unless}}
        {{/if}}
      </div>
    </div>
  </AccModal>
{{/if}}